package conson.tech.manage.app.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import conson.tech.manage.api.app.dto.ChannelAdvertDTO;
import conson.tech.manage.common.util.EntityUtils;
import conson.tech.manage.app.entity.pojo.ChannelAdvert;
import conson.tech.manage.app.mapper.ChannelAdvertMapper;
import conson.tech.manage.app.service.ChannelAdService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * ClassName: ChannelAdServiceImpl
 * Description:
 * Author: HXL
 * Date: 2020/4/22 2:32 下午
 * Version: 1.0
 */
@Service("channelAdService")
public class ChannelAdServiceImpl implements ChannelAdService {

    @Autowired
    private ChannelAdvertMapper channelAdvertMapper;
    @Override
    public List<ChannelAdvertDTO> queryAdvertByChannelCode(String channelCode) {
        QueryWrapper query = new QueryWrapper();
        ChannelAdvert channelAdvert = new ChannelAdvert();
        channelAdvert.setChannelCode(channelCode);
        channelAdvert.setDelFlag(1);
        query.setEntity(channelAdvert);
        List<ChannelAdvert> advertList = channelAdvertMapper.selectList(query);
        return EntityUtils.listToList(advertList,ChannelAdvertDTO.class);
    }
}
